package oa.quertz;

import java.util.Calendar;

import oa.web.service.AttenceService;

import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

public class PunchJob extends QuartzJobBean{

	
	private boolean isRunning = false;
	
	@Autowired
	private AttenceService attenceService;
	
/*	public void setAttenceService(AttenceService attenceService) {
		this.attenceService = attenceService;
	}*/

	@Override
	protected void executeInternal(JobExecutionContext arg0)
			throws JobExecutionException {
		if(!isRunning) {
			isRunning = true;
			attenceService.autoPunch();
			isRunning = false;
		}
	}

}
